import pymysql
connection = pymysql.connect(host='127.0.0.1',port=3306,user='root',passwd='123456',db='py02db',charset='utf8')
cursor = connection.cursor()
# sql_string = "insert into goods(g_name,g_price) values ('%s','%s');"%('烤全羊','100')
# # print(sql_string)
# cursor.execute(sql_string)
# connection.commit()
# cursor.close()
# connection.close()
sql_string = 'select * from goods'
results_count = cursor.execute(sql_string)
desc = cursor.description
print(desc)

print(results_count)
row = cursor.fetchall()

print(row)
print(cursor.lastrowid)

cursor.close()
connection.close()




